﻿<!DOCTYPE html>

<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="utf-8" />
    <title></title>
</head>
<body>
    <script>
        /*let arr = [1, 2, 3];*/
        //arr1 = arr.unshift(1);
        //console.log(arr);

        //let unshift1 = function () {
        //    let arr1 = [];
        //    for (var i = 0; i < arguments.length; i++) {
        //        arr1[i] = arguments[i];
        //    }


        //    for (var i = 0; i < arr.length; i++) {
        //        arr1[arr1.length] = arr[i];
        //    }
        //    arr = arr1
        //    return arr;
        //}
        //console.log(unshift1(1, 2, 3));


        //Array.prototype.unshift1 = function () {
        //    let a = [];
        //    for (var i = 0; i < arguments.length; i++) {
        //        a[i] = arguments[i];
        //    }
        //    for (var i = 0; i < this.length; i++) {
        //        a[a.length] = this[i];
        //    }
        //    return a;
        //}
        //let arr=[1,2,3]
        //arr1 = arr.unshift1(1, 2);
        //console.log(arr1);



       

        //let str = `123456`;
      
        
        //let substr1 = function () {
        ////    let str1 = ``;
        ////    if (arguments[1]) {
        ////        for (var i = arguments[0]; i < arguments[0] + arguments[1]; i++) {

        ////            str1 += str[i];

        ////        }
        ////    } else {
        //        for (var i = arguments[0]; i < str.length; i++) {

        //            str1 += str[i];

        //        }

        //    }
            
        //    return str1;
        //}
       

       



        let arr = [1, 2, 3, 4];
        //str = arr.join(``);
        //console.log(str);
        let join1 = function () {
            let str = ``;
            for (var i = 0; i < arr.length; i++) {
                str = str + arguments[0] + arr[i];
                
            }
            return str;
        }
        
        console.log(join1(`*`));
    </script>
</body>
</html>